package cate.game.play.fighter;

import cate.game.play.skill.Skill;
import easy.java.dev.note.NoteField;
import org.apache.commons.lang3.StringUtils;

public class SkillReplaceCfg {

	@NoteField("被替换的技能的id")
	public Integer tid;

	@NoteField("被替换的技能类型")
	public Byte type;

	@NoteField("被替换的技能的标签")
	public String tag;

	@NoteField("被替换的技能效果类型")
	public String effectType;

	@NoteField("替换后的技能id")
	public int replaceSkill;

	public boolean needReplace(Skill skill) {
		if (tid != null && tid != skill.tid) {
			return false;
		}
		if (type != null && skill.cfg.row.type != type) {
			return false;
		}
		if (StringUtils.isNotBlank(tag) && !skill.cfg.containTag(tag)) {
			return false;
		}
		if (StringUtils.isNotBlank(effectType) && !skill.cfg.isEffectType(effectType)){
			return false;
		}
		return true;
	}
}
